CREATE PROCEDURE RRHH_MODIFICAR_TURNO_L
@IDHORARIO INTEGER,
@HLUNESENTRADA DATETIME,
@HLUNESSALIDA DATETIME,
@HMARTESENTRADA DATETIME,
@HMARTESSALIDA DATETIME,
@HMIERCOLESENTRADA DATETIME,
@HMIERCOLESSALIDA DATETIME,
@HJUEVESENTRADA DATETIME,
@HJUEVESSALIDA DATETIME,
@HVIERNESENTRADA DATETIME,
@HVIERNESSALIDA DATETIME,
@HSABADOENTRADA DATETIME,
@HSABADOSALIDA DATETIME,
@HDOMINGOENTRADA DATETIME,
@HDOMINGOSALIDA DATETIME,
@ESTADOTRAN INTEGER OUTPUT
AS

--SET TRANSACTION ISOLATION LEVEL SERIALIZABLE

BEGIN TRANSACTION

BEGIN TRY
	UPDATE HORARIOXDIA
	SET horaEntrada = @HLUNESENTRADA, horaSalida = @HLUNESSALIDA
	WHERE idDia = 1 AND idHorario = @IDHORARIO
	
	UPDATE HORARIOXDIA
	SET horaEntrada = @HMARTESENTRADA, horaSalida = @HMARTESSALIDA
	WHERE idDia = 2 AND idHorario = @IDHORARIO
	
	UPDATE HORARIOXDIA
	SET horaEntrada = @HMIERCOLESENTRADA, horaSalida = @HMIERCOLESSALIDA
	WHERE idDia = 3 AND idHorario = @IDHORARIO
	
	UPDATE HORARIOXDIA
	SET horaEntrada = @HJUEVESENTRADA, horaSalida = @HJUEVESSALIDA
	WHERE idDia = 4 AND idHorario = @IDHORARIO
	
	UPDATE HORARIOXDIA
	SET horaEntrada = @HVIERNESENTRADA, horaSalida = @HVIERNESSALIDA
	WHERE idDia = 5 AND idHorario = @IDHORARIO
	
	UPDATE HORARIOXDIA
	SET horaEntrada = @HSABADOENTRADA, horaSalida = @HSABADOSALIDA
	WHERE idDia = 6 AND idHorario = @IDHORARIO
	
	UPDATE HORARIOXDIA
	SET horaEntrada = @HDOMINGOENTRADA, horaSalida = @HDOMINGOSALIDA
	WHERE idDia = 7 AND idHorario = @IDHORARIO
	
	SET @ESTADOTRAN = 1
	COMMIT TRANSACTION
END TRY
BEGIN CATCH
	SET @ESTADOTRAN = 0
	ROLLBACK TRANSACTION
END CATCH